import loading from "../shared/libs/loading"

const MyShop = loading(() => import("my-shop"))
const MyFavorite = loading(() => import("order/components/favorite"))
const SizeLibrary = loading(() => import("library"))
const Home = loading(() => import("home"))
const MakeRequest = loading(() => import("order/components/make-request"))
const MyOrder = loading(() => import("order/components/my-order"))
const MyDownload = loading(() => import("order/components/my-download"))
const MyMessage = loading(() => import("message/components/list"))
const MyMerchant = loading(() => import("my-merchant"))

const home = () => ({
  //如果未配置多语言，则使用label
  label: "个人资料",
  //用于key和多语言
  key: "profile",
  code: "profile",
  icon: 'user',
  className: '',
  component: Home,
})


const myShop = () => ({
  //如果未配置多语言，则使用label
  label: "我的门店",
  //用于key和多语言
  key: "my-shop",
  code: "myShop",
  icon: 'shop',
  className: '',
  component: MyShop,
})

const myMerchant = () => ({
  //如果未配置多语言，则使用label
  label: "我的店铺",
  //用于key和多语言
  key: "my-merchant",
  code: "myMerchant:get",
  icon: 'shop',
  className: '',
  component: MyMerchant,
})





const sizeLibrary = () => {
  return {
    //如果未配置多语言，则使用label
    label: "版型库",
    //用于key和多语言
    key: "library",
    code: "library:page",
    icon: 'appstore',
    component: SizeLibrary,
  }
}

const myOrder = () => {
  return {
    //如果未配置多语言，则使用label
    label: "我的订单",
    //用于key和多语言
    key: "my-order",
    code: "my:order",
    icon: "file-text",
    component: null,
    children: [
      {
        label: "版型订单",
        key: "history-order",
        code: "my:order:history",
        component: MyOrder,
      },
      {
        label: "可下载版型",
        key: "my-bought-file",
        code: "my:bought:file",
        component: MyDownload,
      },
      {
        label: "定制订单",
        key: "custom-made-order",
        code: "my:custom:made:order",
        component: MakeRequest,
      },
      {
        label: "下载历史",
        key: "download-history",
        code: "my:download:history",
        component: MakeRequest,
      },
    ]
  }
}


const favorite = () => {
  return {
    //如果未配置多语言，则使用label
    label: "我的收藏",
    //用于key和多语言
    key: "my-favorite",
    code: "favorite:page",
    icon: "heart",
    component: MyFavorite,
  }
}


const myMessage = () => {
  return {
    //如果未配置多语言，则使用label
    label: "我的消息",
    //用于key和多语言
    key: "my-message",
    code: "message:page",
    icon: "message",
    component: MyMessage,
  }
}

const shoppingCart = () => {
  return {
    //如果未配置多语言，则使用label
    label: "购物车",
    //用于key和多语言
    key: "my-shopping-cart",
    code: "shopping",
    icon: "shopping-cart",
    component: null,
  }
}

const buy = () => {
  return {
    //如果未配置多语言，则使用label
    label: "购买记录",
    //用于key和多语言
    key: "buy-history",
    code: "order:buy-history",
    icon: "file-text",
    component: null,
  }
}

const menus = () => {
  return [
    home(),
    myMerchant(),
    myShop(),
    sizeLibrary(),
    myOrder(),
    favorite(),
    buy(),
    myMessage(),
  ]
}

const App = loading(() => import("./app"))

export default menus



